﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<EAILogWebSite.Table_Log>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    EAI Log
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        <%: ViewData["CurrentPage"]%>
        /
        <%: ViewData["TotalPage"] %>
        <%
            int currentPage = int.Parse(ViewData["CurrentPage"].ToString());
            int previousPage = currentPage > 1 ? currentPage - 1 : 1;
            int totalPage = int.Parse(ViewData["TotalPage"].ToString());
            int nextPage = currentPage < totalPage ? currentPage + 1 : totalPage;
            
        %>
        <%: Html.ActionLink("Previous", "Index", "Home", new { pn = previousPage }, new { })%>
        <%: Html.ActionLink("Next", "Index", "Home", new { pn = nextPage }, new { })%>
    </h2>
    <table>
        <tr>
            <th>
                Id
            </th>
            <th>
                LogDateTime
            </th>
            <th>
                MsgType
            </th>
            <th>
                SenderID
            </th>
            <th>
                ReceiverID
            </th>
            <th>
                SrvOpName
            </th>
            <th>
                MsgID
            </th>
            <th>
                CorrID
            </th>
            <th>
                Status
            </th>
            <th>
                Action
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%: item.Id %>
            </td>
            <td>
                <%: String.Format("{0:yyyy/MM/dd hh:mm:ss}", item.LogDateTime) %>
            </td>
            <td>
                <%: item.MsgType %>
            </td>
            <td>
                <%: item.SenderID %>
            </td>
            <td>
                <%: item.ReceiverID %>
            </td>
            <td>
                <%: item.SrvOpName %>
            </td>
            <td>
                <%: item.MsgID %>
            </td>
            <td>
                <%: item.CorrID %>
            </td>
            <td>
                <%: item.ESBRspCode == "0" ? "Success" : "Error"%>
            </td>
            <td>
                <%: Html.ActionLink("Detail", "Detail", new { id = item.Id }, new  { @target="_blank"})%>
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>
